package org.nc.prediction;

import org.apache.log4j.Logger;
import org.nc.beans.Pair;
import org.nc.data.FileDataLoader;

import java.io.IOException;
import java.util.List;

/**
 * @author rbandara
 *         The probe dataset looks like this
 *         111:
 *         3245,2005-12-19
 *         5666,2005-12-23
 *         6789,2005-03-14
 *         225:
 *         1234,2005-05-26
 *         3456,2005-11-07
 *         ...
 *         This class will predict the ratings for the records in probe dataset
 *         It will calculate the RMSE value
 *         <p/>
 *         TODO - complete the implementation
 */
public class ProbeDataSetPredictor {

    Logger logger = Logger.getLogger(this.getClass().getName());

    public void predictForProbeDataSet() throws IOException {
        FileDataLoader loader = new FileDataLoader();
        List<Pair> pairs = loader.loadProbeDataSet();

        for (Pair pair : pairs) {
            RatingPredictor predictor = new RatingPredictor();
            double prediction = predictor.predict(pair.getUserId(), pair.getMovieId());
            logger.debug("Prediction for user,movie " + pair.toString() + " = " + prediction);
        }
    }
}
